<include file="public:header" />
<!--菜单列表-->
<div class="pad_lr_10">
    <div class="J_tablelist table_list" data-acturi="{:U('superadmin/menu/ajax_edit')}">
        <table width="100%" cellspacing="0">
            <thead>
            <tr>
                <th width="40"><input type="checkbox" name="checkall" class="J_checkall"></th>
                <th width="40"><span tdtype="order_by" fieldname="id">ID</span></th>
                <th>{:L('menu_name')}</th>
                <th><span tdtype="order_by" fieldname="ordid">{:L('sort_order')}</span></th>
                <th width="160">{:L('operations_manage')}</th>
            </tr>
            </thead>
            <tbody>
            {$menu_list}
            </tbody>
        </table>
    </div>
    <div class="btn_wrap_fixed">
        <label class="select_all"><input type="checkbox" name="checkall" class="J_checkall">{:L('select_all')}/{:L('cancel')}</label>
        <input type="button" class="btn allbtn" data-tdtype="batch_action" data-acttype="ajax" data-uri="{:U('menu/delete')}" data-name="id" data-msg="{:L('confirm_delete')}" value="{:L('delete')}" />
        <div id="pages">{$page}</div>
    </div>
</div>
<include file="public:footer" />
</body>
<script>
    $(function(){


        $('.allbtn').click(function(){
            var obj = $(this);
            var ids ='';
            var field = obj.attr('data-name');
            $('.J_checkitem').each(function(){
                if($(this).attr('checked') == 'checked')
                {
                    ids += $(this).val() + ',';
                }
            });
            ids = ids.substr(0, (ids.length - 1));
            if(!$.trim(ids))
            {
                layer.msg('请至少选择一个操作项');
                return false;
            }
            layer.confirm($(this).attr('data-msg'),{},function(index)
            {
                $.ajax({
                    type: 'post',
                    data: {id:ids, field:field},
                    dataType: 'json',
                    url : obj.attr('data-uri'),
                    success: function(data){
                        if(!data.status)
                        {
                            layer.msg(data.msg,{icon:2,time:2000});
                        } else {
                            layer.msg(data.msg,{icon:1,time:2000},function(){
                                window.location.reload();
                            });
                        }
                        layer.close(index);
                    }
                });
                return false;
            });
        });
    })

</script>
</html>